package orion.cricScoreCard.Activity;

import android.app.Activity;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.os.Bundle;
import android.view.WindowManager;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.LinearInterpolator;
import android.widget.TextView;

public class Splash extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		setContentView(R.layout.splash);
		getWindow().setFormat(PixelFormat.RGBA_8888);

		getWindow().addFlags(WindowManager.LayoutParams.FLAG_DITHER);
		final int splashScreenDisplay = 3000;
		final Animation animation = new AlphaAnimation(1, (float) .40);
		animation.setDuration(200);
		animation.setInterpolator(new LinearInterpolator());
		animation.setRepeatCount(20);
		animation.setRepeatMode(Animation.REVERSE);
		final TextView loadingText = (TextView) findViewById(R.id.TextView01);
		Thread splashThread = new Thread() {
			int wait = 0;
			@Override
			public void run() {
				try {
					super.run();
					loadingText.startAnimation(animation);
					while (wait < splashScreenDisplay) {
						sleep(100);
						wait += 100;
					}
				} catch (Exception e) {
					System.out.println("EXc=" + e);
				} finally {

					startActivity(new Intent(Splash.this,
							CricScoreCardActivity.class));
					finish();
				}
			}
		};
		splashThread.start();

	}
}
